<#include "../common/layout/__mainlayout.html">
    <#include "../common/__pagination.html">

        <!--设置面包屑-->
        <#assign pageBreadCrumbs>
            <li class="active"><a href="#">建议管理</a></li>
        </#assign>
        <#assign pageCss>
            <!-- page specific plugin styles -->
            <link rel="stylesheet" href="${ctx}/static/admin/assets/css/jquery-ui.custom.css"/>
            <link rel="stylesheet" href="${ctx}/static/admin/assets/css/chosen.css"/>
            <link rel="stylesheet" href="${ctx}/static/admin/assets/css/datepicker.css"/>
            <link rel="stylesheet" href="${ctx}/static/admin/assets/css/daterangepicker.css"/>
        </#assign>

        <#assign pageJavascript>
            <script type="text/javascript">
                $(document).ready(function () {
                    $("#status").val(${query.status!});

                    //初始化范围选择器
                    $('input[name=createTimeRange]').daterangepicker({
                        'applyClass' : 'btn-sm btn-success',
                        'cancelClass' : 'btn-sm btn-default',
                        locale: {
                            applyLabel: '确定',
                            cancelLabel: '取消'
                        }
                    });


                    $('[data-rel=tooltip]').tooltip();

                    if (!ace.vars['touch']) {
                        $('.chosen-select').chosen({allow_single_deselect: true});
                    }

                    // 清除远程modal数据
                    $("#editModal").on("hidden.bs.modal", function () {
                        $(this).removeData("bs.modal");
                    });

                    // 删除按钮
                    $("a.delete").on(ace.click_event,function (e) {
                        submitClickListener(this,e,"删除");
                    });

                    // 显示按钮
                    $("a.upState").on(ace.click_event,function (e) {
                        submitClickListener(this,e,"显示");
                    });

                    // 隐藏按钮
                    $("a.downState").on(ace.click_event,function (e) {
                        submitClickListener(this,e,"隐藏");
                    });

                    function submitClickListener(obj,e,title){
                        var currentA = obj;
                        e.preventDefault();
                        bootbox.confirm({
                                    message: "确定"+title+"该建议?",
                                    buttons: {
                                        confirm: {
                                            label: "确定",
                                            className: "btn-primary btn-sm"
                                        },
                                        cancel: {
                                            label: "取消",
                                            className: "btn-sm"
                                        }
                                    },
                                    callback: function (result) {
                                        if (result) {
                                            url = $(currentA).attr("href");
                                            $.get(url, { },function(data){
                                                if(data){
                                                    window.location.href=window.location.href;
                                                }
                                            });
                                        }
                                    }
                                }
                        );
                    }
                });
            </script>
        </#assign>

        <@mainlayout pageBreadCrumbs=pageBreadCrumbs pageCss=pageCss pageJavascript=pageJavascript
        currentMenu="feedbackFlag">
        <div class="row">
            <div class="col-xs-12">
            <form id="searchForm" class="form-search form-inline">
                <div class="row">
                    <div class="widget-body">
                        <div class="widget-main">
                            <div class="form-group col-xs-12" style="padding-top:10px">
                                <label class="col-xs-1 text-right">状态:</label>
                                <select class=" col-xs-2"  name="status" id="status"  data-placeholder="Choose a State...">
                                    <option value="-1"></option>
                                    <#list statusMap?keys as key>
                                        <option value="${key}">${statusMap[key]?default('')}</option>
                                    </#list>

                                </select>
                                <label class="col-xs-1 text-right">软件版本:</label>
                                <input type="text" id="marketVersion" name="marketVersion" class="input-sm col-xs-2" value="${query.marketVersion!}"/>
                                <label class="col-xs-1 text-right">反馈时间:</label>
                                <input type="text" id="createTimeRange" name="createTimeRange" 　value="${query.createTimeRange!}" class="input-sm col-xs-2" value="${query.createTimeRange!}"/>
                                &nbsp;&nbsp;&nbsp;&nbsp;
                                <input  type="button" id="searchBtn" class="btn btn-sm btn-primary" onclick="search()" value="查询"/>&nbsp;
                            </div>
                        </div>
                    </div>
                </div>

            <table id="adItemTable" class="table table-striped table-bordered table-hover">
                <thead>
                <tr>
                    <th width="40" align="center">用户编号</th>
                    <th width="100" align="left">用户名</th>
                    <th width="70" align="left">联系方式</th>
                    <th width="70" align="left">软件版本</th>
                    <th width="70" align="left">状态</th>
                    <th width="70" align="left">时间</th>
                    <th width="40" align="center">操作</th>
                </tr>
                </thead>
                <tbody>
                <#list feedbacks.listData as feedback>
                    <tr>
                        <td>${feedback.userId!}</td>
                        <td>${feedback.userName!}</td>
                        <td>${feedback.contact!}</td>
                        <td>${feedback.marketVersion!}</td>
                        <td>${feedback.statusName!}</td>
                        <td>${feedback.createTimeShow!}</td>
                        <td>
                            <div class="hidden-sm hidden-xs action-buttons">
                                <a class="green tooltip-success edit" href="${ctx}/admin/feedback/edit.do?id=${feedback.id!}" data-rel="tooltip" data-toggle="modal" data-target="#editModal"><span class="label label-success">回复</span></a>
                                <a class="red tooltip-error delete" href="${ctx}/admin/feedback/del.do?id=${feedback.id!}" data-rel="tooltip" > <span class="label label-danger">删除</span> </a>
                            </div>
                        </td>
                    </tr>
                </#list>
                </tbody>
            </table>
            <@pagination feedbacks!/>
            </form>
        </div>
        </div>

        <div id="editModal" class="modal fade">
            <div class="modal-dialog">
                <div class="modal-content">
                </div>
            </div>
        </div>
    </@mainlayout>